BEGIN {
  remember=100
  samples=0
}
function addtosamples(s)
{
  for(r=samples-1;r>=0;r--)
  {
    times[r+1]=times[r]
  }
  times[0]=s
  if(samples<remember)
    samples++
}
function getaverage()
{
  total=0
  for(r=0;r<samples;r++)
  {
    total+=times[r]
  }
  return total/samples
}
function printsamples()
{
  samp=times[0]
  for(r=1;r<samples;r++)
  {
    samp=samp "," times[r]
  }
  return samp
}
{
  addtosamples($1)
  print $1, getaverage()
}
